using System;
using System.Collections.Generic;
using Sirenix.OdinInspector;
using UnityEngine;

namespace Toolkit.AudioExtend
{
    [CreateAssetMenu(fileName = "AudioStore", menuName = "Scriptable Objects/Audio Store")]
    public class AudioStore : ScriptableObject
    {
        [DrawWithUnity]
        public List<AudioInfo> audioContent;

        public AudioInfo Get(string label)
        {
            label = label.Trim();
            AudioInfo find = audioContent.Find(x => x.label.Trim().Equals(label, StringComparison.OrdinalIgnoreCase));

            if (find == null)
            {
                throw new Exception("AudioContent not found with label: " + label);
            }

            return find;
        }
    }
}